﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt.mysql
{
	// Token: 0x02000156 RID: 342
	public class TMySQLIfStmt : TCustomMySQLStmt
	{
		// Token: 0x06000B8C RID: 2956 RVA: 0x003063DE File Offset: 0x003045DE
		public TMySQLIfStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmysqlifstmt;
		}

		// Token: 0x06000B8D RID: 2957 RVA: 0x003063F2 File Offset: 0x003045F2
		internal override void buildsql()
		{
		}

		// Token: 0x06000B8E RID: 2958 RVA: 0x003063F4 File Offset: 0x003045F4
		internal override void clear()
		{
		}

		// Token: 0x06000B8F RID: 2959 RVA: 0x003063F6 File Offset: 0x003045F6
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000B90 RID: 2960 RVA: 0x003063FD File Offset: 0x003045FD
		internal override void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x06000B91 RID: 2961 RVA: 0x00306400 File Offset: 0x00304600
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TIfSqlNode tifSqlNode = (TIfSqlNode)this.rootNode;
			base.doParseStatement(psql);
			this.condition = tifSqlNode.Condition;
			if (tifSqlNode.ThenStmts != null)
			{
				tifSqlNode.ThenStmts.doParse(this, ESqlClause.unknown);
				for (int i = 0; i < tifSqlNode.ThenStmts.size(); i++)
				{
					this.ThenStmts.add(tifSqlNode.ThenStmts.getStatementSqlNode(i).Stmt);
				}
			}
			if (tifSqlNode.ElseIfList != null)
			{
				tifSqlNode.ElseIfList.doParse(this, ESqlClause.unknown);
				this.elseIfList = tifSqlNode.ElseIfList;
			}
			if (tifSqlNode.ElseStmts != null)
			{
				tifSqlNode.ElseStmts.doParse(this, ESqlClause.unknown);
				for (int j = 0; j < tifSqlNode.ElseStmts.size(); j++)
				{
					this.DefaultStmts.add(tifSqlNode.ElseStmts.getStatementSqlNode(j).Stmt);
				}
			}
			return 0;
		}

		// Token: 0x1700021E RID: 542
		// (get) Token: 0x06000B92 RID: 2962 RVA: 0x003064E7 File Offset: 0x003046E7
		// (set) Token: 0x06000B93 RID: 2963 RVA: 0x003064EF File Offset: 0x003046EF
		public virtual TExpression Condition
		{
			get
			{
				return this.condition;
			}
			set
			{
				this.condition = value;
			}
		}

		// Token: 0x1700021F RID: 543
		// (get) Token: 0x06000B94 RID: 2964 RVA: 0x003064F8 File Offset: 0x003046F8
		// (set) Token: 0x06000B95 RID: 2965 RVA: 0x00306513 File Offset: 0x00304713
		public virtual TStatementList DefaultStmts
		{
			get
			{
				if (this.defaultStmts == null)
				{
					this.defaultStmts = new TStatementList();
				}
				return this.defaultStmts;
			}
			set
			{
				this.defaultStmts = value;
			}
		}

		// Token: 0x17000220 RID: 544
		// (get) Token: 0x06000B96 RID: 2966 RVA: 0x0030651C File Offset: 0x0030471C
		// (set) Token: 0x06000B97 RID: 2967 RVA: 0x00306537 File Offset: 0x00304737
		public virtual TStatementList ThenStmts
		{
			get
			{
				if (this.thenStmts == null)
				{
					this.thenStmts = new TStatementList();
				}
				return this.thenStmts;
			}
			set
			{
				this.thenStmts = value;
			}
		}

		// Token: 0x17000221 RID: 545
		// (get) Token: 0x06000B98 RID: 2968 RVA: 0x00306540 File Offset: 0x00304740
		// (set) Token: 0x06000B99 RID: 2969 RVA: 0x00306548 File Offset: 0x00304748
		public virtual TElseIfSqlNodeList ElseIfList
		{
			get
			{
				return this.elseIfList;
			}
			set
			{
				this.elseIfList = value;
			}
		}

		// Token: 0x06000B9A RID: 2970 RVA: 0x00306551 File Offset: 0x00304751
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000B9B RID: 2971 RVA: 0x00306564 File Offset: 0x00304764
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			this.condition.accept(v);
			if (this.thenStmts != null)
			{
				this.thenStmts.accept(v);
			}
			if (this.elseIfList != null)
			{
				this.elseIfList.accept(v);
			}
			if (this.defaultStmts != null)
			{
				this.defaultStmts.accept(v);
			}
			v.postVisit(this);
		}

		// Token: 0x040012B8 RID: 4792
		private TExpression condition;

		// Token: 0x040012B9 RID: 4793
		private TStatementList thenStmts;

		// Token: 0x040012BA RID: 4794
		private TStatementList defaultStmts;

		// Token: 0x040012BB RID: 4795
		private TElseIfSqlNodeList elseIfList;
	}
}
